<!--
 * @Author: your name
 * @Date: 2020-12-21 10:58:48
 * @LastEditTime: 2020-12-21 11:02:00
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \basicjs\event\moren.html
-->

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <a href="https://www.houdunren.com">后盾人</a>

    <script>
        
        //使用onclick绑定的事件处理程序,使用retrun false可以阻止默认行为
        //推荐使用event.preventDefault()阻止默认行为
        document.querySelector('a').addEventListener('click',() => {
            // event.preventDefault();
            alert(event.target.innerText);
            // return false;
        });
    </script>

</body>
</html>